/*
 ============================================================================
 Name        : FS.c
 Author      : Pablo Arias
 Version     : v0.1
 Copyright   : None
 Description : Primeros intentos de mappear el FS.
 	 	 	   ATENCION: Para usarlo tienen que cambiar el FILEPATH con la
 	 	 	   direccion donde tienen guardado el disco.
 ============================================================================
 */

#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
#include <sys/mman.h>
#include <unistd.h>


#define FILEPATH "/home/utn_so/Desarrollo/Workspace/FS Online/fat32.disk"

int main(void) {



	int disk;
	char bootSector[512];
	char *map;
	int i;

	int sz = getpagesize();

	printf("el tamano de la pagina de memoria es: %d bytes\n\n",sz);

	disk = open(FILEPATH, O_RDONLY);

	map = mmap(0,1,PROT_READ ,MAP_PRIVATE, disk, 0);

	  for (i = 0; i <=511; ++i) {
		  bootSector[i]= map[i];
	 	  printf("%d: %d\n", i, bootSector[i]);
	    }


	  close(disk);
	return EXIT_SUCCESS;
}
